  <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'Regist.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">-0690[]
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link type="text/css" rel="stylesheet"
	href="/EasyBuy/statics/css/style.css" />

<script type="text/javascript"
	src="/EasyBuy/statics/js/jquery-1.11.1.min_044d0927.js"></script>
<script type="text/javascript"
	src="/EasyBuy/statics/js/jquery.bxslider_e88acd1b.js"></script>

<script type="text/javascript"
	src="/EasyBuy/statics/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/menu.js"></script>

<script type="text/javascript" src="/EasyBuy/statics/js/select.js"></script>

<script type="text/javascript" src="/EasyBuy/statics/js/lrscroll.js"></script>

<script type="text/javascript" src="/EasyBuy/statics/js/iban.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/fban.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/f_ban.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/mban.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/bban.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/hban.js"></script>
<script type="text/javascript" src="/EasyBuy/statics/js/tban.js"></script>

<script type="text/javascript" src="/EasyBuy/statics/js/lrscroll_1.js"></script>
		<style type="text/css">
			#code{
				font-family:Arial;
				font-style:italic;
				font-weight:bold;
				border:0;
				letter-spacing:10px;
				color:blue;
				height: 35px;
				outline：none;
				width: 80px;
				height: 40px;
			}
			
		</style>

</head>

<body>
	<!--Begin Header Begin-->
	<div class="soubg">
		<div class="sou">
			<span class="fr"> <span class="fl">你好，请<a
					href="/EasyBuy/pre/Login.jsp">登录</a>&nbsp; <a href="Regist.html"
					style="color:#ff4e00;">免费注册</a>&nbsp; </span> <span class="fl">|&nbsp;关注我们：</span>
				<span class="s_sh"><a href="#" class="sh1">新浪</a><a href="#"
					class="sh2">微信</a>
			</span> <span class="fr">|&nbsp;<a href="#">手机版&nbsp;<img
						src="/EasyBuy/statics/images/s_tel.png" align="absmiddle" />
				</a>
			</span> </span>
		</div>
	</div>
	<!--End Header End-->
	<!--Begin Login Begin-->
	<div class="log_bg">
		<div class="top">
			<div class="logo">
				<a href="Index.html"><img src="/EasyBuy/statics/images/logo.png" />
				</a>
			</div>
		</div>
		<div class="regist">
			<div class="log_img">
				<img src="/EasyBuy/statics/images/l_img.png" width="611" height="425" />
			</div>
			<div class="reg_c">
				<form>
					<table border="0"
						style="width:420px; font-size:14px; margin-top:20px;"
						cellspacing="0" cellpadding="0">
						<tr height="50" valign="top">
							<td width="95">&nbsp;</td>
							<td><span class="fl" style="font-size:24px;">注册</span> <span
								class="fr">已有商城账号，<a href="/EasyBuy/pre/Login.jsp"
									style="color:#ff4e00;">我要登录</a>
							</span></td>
						</tr> 
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;用户名
								&nbsp;</td>
							<td><input type="text" name="username"  class="l_user" placeholder="英文、数字长度为6-10个字符" required pattern="[a-zA-Z0-9]{6,10}" id="username"/>
							</td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;密码
								&nbsp;</td>
							<td><input type="password" name="pwd" class="l_pwd" id="pwd" placeholder="长度为6-10个字符" required pattern="[a-zA-Z0-9]{6,16}"/>
							</td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;确认密码
								&nbsp;</td>
							<td><input type="password" name="qpwd"  class="l_pwd" id="qpwd" required/>
							</td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;邮箱
								&nbsp;</td>
							<td><input type="text"  name="email" class="l_email" id="l_email" placeholder="123456@qq.com" required pattern="^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$"/>
							</td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;手机
								&nbsp;</td>
							<td><input type="text" name="phone"  class="l_tel" id="phone" required pattern="^0{0,1}(13[0-9]|15[0-9]|153|156|18[7-9])[0-9]{8}$"/>
							</td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;身份证号
								&nbsp;</td>
							<td><input type="text" name="mem" class="l_mem" id="l_mem" required pattern="(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)"/>
							</td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;真实姓名
								&nbsp;</td>
							<td><input type="text" name="num" class="l_num" id="l_num" required pattern="^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,20}$"/>
							</td>
						</tr>
						<tr height="50">
							<td align="right"><font color="#ff4e00">*</font>&nbsp;验证码
								&nbsp;</td>
							<td><input type="text" name="ipt" class="l_ipt" id="l_ipt" required/> 
							<input type = "button" id="code"/><a href="#" id="cod">换一张</a></td>
						</tr>
						<tr>
							<td>&nbsp;</td>
							<td style="font-size:12px; padding-top:20px;"><span
								style="font-family:'宋体';" class="fl"> <label
									class="r_rad"><input type="checkbox" id="box"/>
								</label><label class="r_txt">我已阅读并接受《用户协议》</label> </span></td>
						</tr>
						<tr height="60">
							<td>&nbsp;</td>
							<td><input type="button" value="立即注册" class="log_btn" />
							</td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</div>
	<!--End Login End-->
	<!--Begin Footer Begin-->
	<div class="btmbg">
		<div class="btm">
			备案/许可证编号：蜀ICP备12009302号-1-www.dingguagua.com Copyright © 2015-2018
			尤洪商城网 All Rights Reserved. 复制必究 , Technical Support: Dgg Group <br />
			<img src="/EasyBuy/statics/images/b_1.gif" width="98" height="33" /><img
				src="/EasyBuy/statics/images/b_2.gif" width="98" height="33" /><img
				src="/EasyBuy/statics/images/b_3.gif" width="98" height="33" /><img
				src="/EasyBuy/statics/images/b_4.gif" width="98" height="33" /><img
				src="/EasyBuy/statics/images/b_5.gif" width="98" height="33" /><img
				src="/EasyBuy/statics/images/b_6.gif" width="98" height="33" />
		</div>
	</div>
	<!--End Footer End -->

	<script type="text/javascript"
		src="/EasyBuy/statics/js/jquery-1.8.2.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {

				var emaill = /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/;
				var phone = /^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/;
							
				var name=$(".l_user").val(); //用户名        一下提取 value值全部   不能将值存进变量名中 有误  本电脑提取不出
							
				var pwd= $("#pwd1").val(); //第一次密码
				var pwd2= $("#pwd2").val(); //确认密码
				var email= $(".l_email").val(); //邮箱
				var telphone= $(".l_tel").val(); //手机号
				var ipt = $(".l_ipt").val(); //验证码
	
				createCode();//验证码方法
				
				var code ; //在全局定义验证码
				//产生验证码
				function createCode(){
					 code = ""; 
					 var codeLength = 4;//验证码的长度
					 var checkCode = document.getElementById("code"); 
					 var random = new Array(0,1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R',
					 'S','T','U','V','W','X','Y','Z');//随机数
					 for(var i = 0; i < codeLength; i++) {//循环操作
						var index = Math.floor(Math.random()*36);//取得随机数的索引（0~35）
						code += random[index];//根据索引取得随机数加到code上
					}
					checkCode.value = code;//把code值赋给验证码
				};
				//点击验证码刷新事件
				$("#code,#cod").click(function(){
					createCode();
					$("#code").css({"outline":"none"});
				});
				//鼠标移上变手
				$("#code").mouseover(function(){
					$(this).css("cursor","pointer");
				});
				$(".log_btn").click(function() {
					var username=document.getElementById("username");//用户名DOM对象
					var pwd=document.getElementById("pwd");//密码DOM对象
					var qpwd=document.getElementById("qpwd");//确认密码DOM对象
					var l_email=document.getElementById("l_email");//邮箱DOM对象
					var phone=document.getElementById("phone");//手机DOM对象
					var l_mem=document.getElementById("l_mem");//身份证DOM对象
					var l_num=document.getElementById("l_num");//真实姓名DOM对象
					var l_ipt=document.getElementById("l_ipt");//验证码DOM对象
					
					var ue=$(username).val();//用户名输入信息
					var pd=$(pwd).val();
					var qd=$(qpwd).val();
					var ll=$(l_email).val();
					var pe=$(phone).val();
					var mm=$(l_mem).val();
					var nm=$(l_num).val();
					//用户名
					if(ue == ""){
						alert("用户名不能为空");
					}else if(pd == ""){
						alert("密码不能为空");
					}else if(qd == ""){
						alert("确认密码不能为空");
					}else if(ll == ""){
						alert("邮箱不能为空");
					}else if(pe == ""){
						alert("手机不能空");
					}else if(mm == ""){
						alert("身份证号不能为空");
					}else if(nm == ""){
						alert("真实姓名不能为空");
					}
					/*if(username.validity.valueMissing==true){
						//username.setCustomValidity("用户名不能为空");
						
					}else if(username.validity.patternMismatch==true){
						//username.setCustomValidity("请输入英文、数字长度为6-10个字符");
					}
					//密码
					if(pwd.validity.valueMissing==true){
						pwd.setCustomValidity("请输入密码");
					}else if(pwd.validity.patternMismatch==true){
						pwd.setCustomValidity("请输入长度为6-10个字符");
					}
					//确认密码
					if(qpwd.validity.valueMissing==true){
						qpwd.setCustomValidity("请输入确认密码");
					}else if($(pwd).val()!=$(qpwd).val()){
						qpwd.setCustomValidity("两次密码输入不对");
					}else{
						qpwd.setCustomValidity("");
					};
					//邮箱
					if(l_email.validity.valueMissing==true){
						l_email.setCustomValidity("请输入邮箱");
					}else if(l_email.validity.patternMismatch==true){
						l_email.setCustomValidity("请按邮箱格式输入");
					}else{
						l_email.setCustomValidity("");
					};
					//手机
					if(phone.validity.valueMissing==true){
						phone.setCustomValidity("请输入手机号");
					}else if(phone.validity.patternMismatch==true){
						phone.setCustomValidity("请按手机格式输入");
					}else{
						phone.setCustomValidity("");
					};
					//身份证号
					if(l_mem.validity.valueMissing==true){
						l_mem.setCustomValidity("请输入身份证号");
					}else if(l_mem.validity.patternMismatch==true){
						l_mem.setCustomValidity("请按身份证号格式输入");
					}else{
						l_mem.setCustomValidity("");
					};
					//真实姓名
					if(l_num.validity.valueMissing==true){
						l_num.setCustomValidity("请输入真实姓名");
					}else if(l_num.validity.patternMismatch==true){
						l_num.setCustomValidity("请不要乱写");
					}else{
						l_num.setCustomValidity("");
					};
					var inputCode = $(".l_ipt").val().toUpperCase();
					//验证码
					if(l_ipt.validity.valueMissing==true){
						l_ipt.setCustomValidity("请输入验证码");
					}else if(inputCode!=code){
						l_ipt.setCustomValidity("验证码输入错误");
						//createCode();
					}else{
						l_ipt.setCustomValidity("");
					};*/
					if($("input[type='checkbox']").is(':checked')){
						$.get("/EasyBuy/LoginAndregisterServlet","opr=add&username="+ue+"&pwd="+qd+"&email="+ll+"&phone="+pe+"&sfz="+mm+"&zsname="+nm,function(data){
							if(data == "cg"){
								location.href = "/EasyBuy/pre/Login.jsp";
							}else if(data == "sb"){
								location.href = "/EasyBuy/pre/Regist.jsp";
							}
						});
					}
					});
			});
	</script>
</body>
</html>
